import React, { Component } from 'react'

export default class App extends Component {
  render() {
    return (
      <div>
        <input type="text" ref="input" /><button onClick={this.show}>显示</button>
        <hr />
        <div ref="box" style={{width: '400px',height: '300px', border: 'solid 2px #520'}}></div>
      </div>
    )
  }

  show = (e) => {
    //获取 input 元素
    let v = this.refs.input.value;
    //设置标签的文本
    this.refs.box.innerHTML = v;
  }

}

